package com.timoon.component.panel.tree.ztree;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.timoon.component.panel.tree.ztree.checkboxtree.ZTreeCheckboxPanel;
import com.timoon.component.util.ComponentConstant;

/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013.4.1</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */

@Controller
@RequestMapping(value="ztree")
public class ZTreeController {

	@ResponseBody
	@RequestMapping(value="/setCheckedIds/{key}/{ids}",method=RequestMethod.GET)
	public void setCheckedIds(@PathVariable String key,@PathVariable String ids,HttpServletRequest request, HttpServletResponse response){
		HttpSession session=request.getSession();
		Map<String,ZTreeCheckboxPanel> map=(Map<String, ZTreeCheckboxPanel>) session.getAttribute(ComponentConstant.ZTREE_CHECKBOX_PANEL_MAP_IN_SESSION);
		ZTreeCheckboxPanel panel=map.get(key);
		panel.onChecked(ids.split(","));
	}
}
